<%@ page language="java" contentType="text/html; charset=utf-8 " import="domain.Article,java.util.*,service.article.*"
pageEncoding="utf-8"%>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta charset="utf-8" />
		<meta charset="utf-8">
	<title>文章列表</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="../../css/public.css" media="all" />
	<link rel="stylesheet" type="text/css" href="news.css"/>
	<link href="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css" rel="stylesheet">
	<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
	<script src="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.js"></script>
	<link href="dist/summernote.css" rel="stylesheet">
	<script src="dist/summernote.js"></script>
</head>
<% int hasUpdate = 0;
    Article article = new Article();
    ArticleService articleService = new ArticleServiceImpl();
    if(request.getParameter("id")!=null){
        hasUpdate = 1;
        article = articleService.getArticleInfo(Integer.parseInt(request.getParameter("id")));
    }
%>
<body class="childrenBody">
<% if(hasUpdate==0){ %>
<form action="../../../CreatNews" class="layui-form layui-row layui-col-space10" method="post" >
<div class="layui-col-md9 layui-col-xs12">
		<div class="layui-row layui-col-space10">
			<div class="layui-col-md9 layui-col-xs7">
				<div class="layui-form-item magt3">
					<label class="layui-form-label">文章标题</label>
					<div class="layui-input-block">
						<input type="text" name="title" id="title" class="layui-input newsName" lay-verify="newsName"  placeholder="请输入文章标题">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">内容摘要</label>
					<div class="layui-input-block">
						<textarea name="abs" id="abs" placeholder="请输入内容摘要" class="layui-textarea abstract"></textarea>
					</div>
				</div>
			</div>

		</div>
		<div class="layui-form-item magb0">
			<label class="layui-form-label">文章内容</label>
			<div class="layui-input-block">
				<textarea  name="news_content" id="news_content"></textarea>
			</div>
		</div>
	</div>
	<div class="layui-col-md3 layui-col-xs12">
		<blockquote class="layui-elem-quote title"><i class="seraph icon-caidan"></i> 所属模块</blockquote>
		<div class="border category">
			<div class="layui-input-block">
				<input type="radio" name="type"  title="公司动态" lay-skin="primary" value="1" lay-filter="release"  />
				<input type="radio" name="type"  title="日本留学" lay-skin="primary" value="2" lay-filter="release" />
				<input type="radio" name="type" title="旅程规划" lay-skin="primary" value="3" lay-filter="release" />
			</div>
		</div>
		<blockquote class="layui-elem-quote title magt10"><i class="layui-icon">&#xe609;</i> 发布</blockquote>
		<div class="border">

			<div class="layui-form-item">
				<label class="layui-form-label"><i class="layui-icon">&#xe609;</i> 发　布</label>
				<div class="layui-input-block">
					<input type="radio" name="state" title="立即发布" value="1" lay-skin="primary" lay-filter="release" checked />
					<input type="radio" name="state" title="保存草稿" value="0" lay-skin="primary" lay-filter="release" />
				</div>
			</div>

			<hr class="layui-bg-gray" />
			<div class="layui-right">
				<button type="submit"><i class="layui-icon">&#xe609;</i>发布</button>

			</div>
		</div>
	</div>
</form>
<% } if(hasUpdate==1){ %>
<form action="../../../UpdateNews?id=<%=article.getId() %>" class="layui-form layui-row layui-col-space10" method="post" >
	<div class="layui-col-md9 layui-col-xs12">
		<div class="layui-row layui-col-space10">
			<div class="layui-col-md9 layui-col-xs7">
				<div class="layui-form-item magt3">
					<label class="layui-form-label">文章标题</label>
					<div class="layui-input-block">
						<input type="text" name="title" id="title" class="layui-input newsName" lay-verify="newsName" placeholder="请输入文章标题" value="<%=article.getTitle() %>">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">内容摘要</label>
					<div class="layui-input-block">
						<textarea name="abs" id="abs" placeholder="请输入内容摘要" class="layui-textarea abstract"><%=article.getAbs() %></textarea>
					</div>
				</div>
			</div>
			
		</div>
		<div class="layui-form-item magb0">
			<label class="layui-form-label">文章内容</label>
			<div class="layui-input-block">
				<textarea  name="news_content" id="news_content"><%=article.getInfo() %></textarea>
			</div>
		</div>
	</div>
	<div class="layui-col-md3 layui-col-xs12">
		<blockquote class="layui-elem-quote title"><i class="seraph icon-caidan"></i> 所属模块</blockquote>
		<div class="border category">
			<div class="layui-input-block">
				<input type="radio" name="type"  title="公司动态" lay-skin="primary" value="1" lay-filter="release" <% if(article.getType()==1){ %>checked <% }%> />
				<input type="radio" name="type"  title="日本留学" lay-skin="primary" value="2" lay-filter="release" <% if(article.getType()==2){ %>checked <% }%>/>
				<input type="radio" name="type" title="旅程规划" lay-skin="primary" value="3" lay-filter="release" <% if(article.getType()==3){ %>checked <% }%>/>
			</div>
		</div>
		<blockquote class="layui-elem-quote title magt10"><i class="layui-icon">&#xe609;</i> 发布</blockquote>
		<div class="border">
			
			<div class="layui-form-item">
				<label class="layui-form-label"><i class="layui-icon">&#xe609;</i> 发　布</label>
				<div class="layui-input-block">
					<input type="radio" name="state" title="立即发布" value="1" lay-skin="primary" lay-filter="release" <% if(article.getState()==1){ %>checked <% }%> />
					<input type="radio" name="state" title="保存草稿" value="0" lay-skin="primary" lay-filter="release" <% if(article.getState()==0){ %>checked <% }%> />
				</div>
			</div>
			
			<hr class="layui-bg-gray" />
			<div class="layui-right">
				<button type="submit"><i class="layui-icon">&#xe609;</i>发布</button>

			</div>
		</div>
	</div>
</form>
<% } %>
<% if(request.getParameter("msg")!=null){
		int msg = Integer.parseInt(request.getParameter("msg"));
        		    if(msg==1){
        		     %>
        		    <div style="color:red">操作成功</div>
        		 <%   }if(msg==0){ %>
        		 <div style="color:red">操作失败</div>
        		 <% }} %>
<script type="text/javascript">
	$(document).ready(function() {
	        $('#news_content').summernote();
	    });
</script>
<script type="text/javascript" src="../../layui/layui.js"></script>
<script type="text/javascript" src="newsAdd.js"></script>
</body>
</html>